package com.twang.stock.controller.phone;

import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.twang.stock.Entity.ShiShiData;
import com.twang.stock.common.http.HtmlTools;
import com.twang.stock.design.impl.OneThsHotStockListTask;
import com.twang.stock.design.impl.ThsHotStockListTask;
import com.twang.stock.design.impl.TodayQinXuTask;
import com.twang.stock.dto.BaseRequest;
import com.twang.stock.entity.DfcfBanKuaiMaoLiLv;
import com.twang.stock.entity.User;
import com.twang.stock.entity.ex.CompanyStockMinutesEx;
import com.twang.stock.redis.RedisUtil;
import com.twang.stock.service.*;
import com.twang.stock.service.impl.CompanyStockServiceImpl;
import com.twang.stock.service.impl.IndexServiceImpl;
import com.twang.stock.task.QueryBanKuaiAndDaPan;
import com.twang.stock.task.old.BaseTask;
import com.twang.stock.utils.date.HolidayCopy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;

@Controller
@RequestMapping(value = "/web")
@Slf4j
public class H5IndexController {

    @Autowired
    private IndexService indexService;

    @Autowired
    private MinutesChengJIaoeService minutesChengJIaoeService;
    @RequestMapping(value = "/")
    public ModelAndView indexNew(BaseRequest request) throws Exception {
        ModelAndView modelAndView = new ModelAndView();
        OneThsHotStockListTask.dataSize=5;
        ThsHotStockListTask.dataSize=50;
        indexService.indexDataInitNew(modelAndView);
        indexService.获取市场高度(modelAndView);
        indexService.获取市场涨停成交额(modelAndView);
        modelAndView.setViewName("web/index");
        return modelAndView;
    }

    /**
     * 大成交
     * @param date
     * @return
     */
    @RequestMapping(value = "/hangqing")
    public ModelAndView hangqing(String date) throws InterruptedException {
        ModelAndView modelAndView = new ModelAndView();
        List<CompanyStockMinutesEx> todayVolumeExceedingBillion = minutesChengJIaoeService.getTodayVolumeExceedingBillion(date);
        modelAndView.addObject("todayVolumeExceedingBillion", todayVolumeExceedingBillion);
        modelAndView.setViewName("billionTradeStock");
        modelAndView.setViewName("web/hangqing");
        return modelAndView;
    }

    /**
     * 消息
     * @return
     */
    @RequestMapping(value = "/faxian")
    public ModelAndView faxian( ) {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("web/faxian");
        return modelAndView;
    }

    /**
     * 我的
     * @param request
     * @return
     */
    @RequestMapping(value = "/wode")
    public ModelAndView wode(BaseRequest request) {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("web/wode");
        return modelAndView;
    }

}
